<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of articulos
 *
 * @author emontoro
 */
class ebarrio extends CI_Controller {

    function ebarrio() {
        parent::__construct();
        $this->load->library('tank_auth');
    }
    function index() {
        // Cargo el helper de url, con funciones para trabajo con URL del sitio
        $this->load->helper('url');

        $datos = array(
                    'publickey' => $this->config->item('captcha_publickey')
                );

        $this->load->view('prueba_extjs_01', $datos );
    }

    function recupera_info() {
        // Función que recupera información solicitada desde el cliente de ExtJs
        $recupera   = $this->input->post('titulo');

        $this->load->model('recupera_info');

        $result = $this->recupera_info->getList();

        echo $result;

    }// fin de recupera_info


    function recupera_info2() {

        $callback = $_REQUEST['callback'];

        // your SQL query here..

        while ($vals = mysql_fetch_array($records)) {
            $cant++;
            $items[] = Array("post_id"=>$cant,"fname"=>$vals['FNAME'],"lname"=>$vals[LNAME]);
        }
        $cant=0;

        $result = Array();
        $result = $items;

        echo $callback . '(' . json_encode(Array('totalCount' => $nbrows, 'topics' => $result ) ) . ');';

    }

    function recupera_info3() {
        // Función que recupera información solicitada desde el cliente de ExtJs
        $recupera   = $this->input->post('titulo');

        $this->load->model('recupera_info');

        switch($recupera){
            case "LISTING":              // Give the entire list
                $this->recupera_info->getList();
                break;
            default:
                echo "{failure:true}";  // Simple 1-dim JSON array to tell Ext the request failed.
                break;
        } //Fin del switch

    }// fin de recupera_info


}

?>
